package com.ocm.tourism.core.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.TableGenerator;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Configurable;

@Entity
@Configurable
public class Comment {

   @Id
   @GeneratedValue(strategy = GenerationType.TABLE, generator = "GEN_COMMENT")
   @TableGenerator(name = "GEN_COMMENT", table = "SEQUENCE_LIST", allocationSize = 1, initialValue = 1, pkColumnName = "NAME", valueColumnName = "NEXT_SEQUENCE", pkColumnValue = "COMMENT")
   @Column(name = "COMMENT_ID")
   private Long id;

   @NotEmpty
   private String content;

   private String createdUser;

   private Date createdDate;

   @ManyToOne
   private Participant participant;

   private Long businessId;

   private String attractionType;

   private Long catalogueId;

   private Long tourId;

   private Long saleId;

   public Long getId() {
      return id;
   }

   public void setId(Long id) {
      this.id = id;
   }

   public String getCreatedUser() {
      return createdUser;
   }

   public void setCreatedUser(String createdUser) {
      this.createdUser = createdUser;
   }

   public Date getCreatedDate() {
      return createdDate;
   }

   public void setCreatedDate(Date createdDate) {
      this.createdDate = createdDate;
   }

   public String getContent() {
      return content;
   }

   public void setContent(String content) {
      this.content = content;
   }

   public Participant getParticipant() {
      return participant;
   }

   public void setParticipant(Participant participant) {
      this.participant = participant;
   }

   public Long getBusinessId() {
      return businessId;
   }

   public void setBusinessId(Long businessId) {
      this.businessId = businessId;
   }

   public String getAttractionType() {
      return attractionType;
   }

   public void setAttractionType(String attractionType) {
      this.attractionType = attractionType;
   }

   public Long getCatalogueId() {
      return catalogueId;
   }

   public void setCatalogueId(Long catalogueId) {
      this.catalogueId = catalogueId;
   }

   public Long getTourId() {
      return tourId;
   }

   public void setTourId(Long tourId) {
      this.tourId = tourId;
   }

   public Long getSaleId() {
      return saleId;
   }

   public void setSaleId(Long saleId) {
      this.saleId = saleId;
   }

   @Override
   public boolean equals(Object obj) {
      Comment propertyCompare = (Comment) obj;
      if (this.getId().longValue() == propertyCompare.getId().longValue()) {
         return true;
      }
      return false;
   }
   
   public String toString() {
      return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
   }
}
